<?php

use think\migration\Migrator;
use think\migration\db\Column;

class Journals extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change()
    {
        $table = $this->table('journals', array('engine' => 'MyISAM', 'comment' => '工作周报表'));
          $table->addColumn('journal_no', 'string', array('limit' => 50, 'null' => true, 'comment' => '日志编号'))
                ->addColumn('admin_id', 'integer', array('limit' => 11, 'null' => true, 'comment' => '填写人id'))
                ->addColumn('admin_name', 'string', array('limit' => 55, 'null' => true, 'comment' => '名称'))
                ->addColumn('group_id', 'integer', array('limit' => 11, 'null' => true, 'comment' => '部门id'))
                ->addColumn('group_name', 'string', array('limit' => 55, 'null' => true, 'comment' => '部门名称'))
                ->addColumn('is_week', 'string', array('limit' => 225, 'null' => true, 'comment' => '第几周'))
                ->addColumn('week_time', 'string', array('limit' => 225, 'null' => true, 'comment' => '第几周时间范围'))
                ->addColumn('journal_type_id', 'integer', array('limit' => 11, 'null' => true, 'comment' => '日志类别id'))
                ->addColumn('journal_level_id', 'integer', array('limit' => 11, 'null' => true, 'comment' => '日志级别id'))
                ->addColumn('markdown_content', 'text', array('null' => true, 'comment' => '原因（markdown格式）'))
                ->addColumn('html_content', 'text', array('null' => true, 'comment' => '原因 （html格式）'))
                ->addColumn('status', 'boolean', array('limit' => 1, 'default' => 0, 'comment' => '状态 是否审批 0草稿箱，1提交,2审批'))
                ->addTimestamps()
                ->addSoftDelete()
                ->create();
    }
}
